{% from "wiki/includes/flag_form.html" import flag_form with context %}

<div class="author">
  <a class="avatar" href="{{ profile_url(post.creator, request.user == post.creator) }}">
    <img src="{{ profile_avatar(post.creator) }}" height="45" width="45" alt=""/>
  </a>
  <a class="author-name" href="{{ profile_url(post.creator, request.user == post.creator) }}">{{ display_name(post.creator) }}</a>

  <ul>
    <li>{{ private_message(post.creator) }}</li>
    {% if post.id and (perms.kbforums.change_post or (post.creator == request.user and not thread.is_locked)) %}
      <li><a href="{{ url('wiki.discuss.edit_post', document.slug, thread.id, post.id) }}">{{ _('Edit this post') }}</a></li>
    {% endif %}
    {% if post.id and perms.kbforums.delete_post %}
      <li><a href="{{ url('wiki.discuss.delete_post', document.slug, thread.id, post.id) }}">{{ _('Delete this post') }}</a></li>
    {% endif %}
  </ul>

  {% with count = post.creator.post_set.count() %}
    {# L10n: {0} is the number of posts. #}
    <span class="posts">{{ ngettext('1 post', '{0} posts', count)|f(count) }}</span>
  {% endwith %}
  <div class="post-actions">
    {% if document and document.slug and post.id %}
      {{ flag_form(url('wiki.discuss.flag_post', document.slug, post.id)) }}
    {% endif %}
  </div>
</div>
<div class="content">
  {{ post.content_parsed }}
</div>
<div class="content-raw">{{ post.content }}</div>
<div class="info">
  {{ datetimeformat(post.created, format='longdatetime') }}
  <a href="#post-{{ post.id }}" class="permalink" title="{{ _('Link to this post.') }}">#</a>
  {% if post.id and user.is_authenticated() and not thread.is_locked %}
    <span class="post-action">
      <a class="reply" data-post="{{ post.id }}" href="#thread-reply">{{ _('Quote') }}</a>
    </span>
  {% endif %}
  {% if post.updated_by %}
    <span class="post-modified">
      {{ _('Modified by {name} on {datetime}')|fe(name=display_name(post.updated_by), datetime=datetimeformat(post.updated, format='longdatetime')) }}
    </span>
  {% endif %}
</div>
